home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / docs / hyper / BuffyGuide.lha / BuffyGuide / source / Search.guide.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-26  |  1.7 KB  |  70 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. #include "Search.h"
  5.  
  6. // -----------------------------
  7. // writes AmigaGuide file header
  8. // -----------------------------
  9. void write_header(void) {
  10. char stuff[1000]="";
  11.  
  12. struct tm *tp;
  13. time_t timestamp=0;  // time stuff
  14.  
  15.     // ------------------------
  16.     // BuffyResults file header
  17.     // write out to new file
  18.     // ------------------------
  19.  
  20.     fputs("@database \"BuffyResults.guide\"\n",temp_fp);
  21.     fputs("@font XHelvetica.font 11\n",temp_fp);
  22.     fputs("@author \"BuffyGuideSearch v1.0\"\n",temp_fp);
  23.     fputs("@wordwrap\n",temp_fp);
  24.     fputs("@node MAIN \"Buffy Search Results\"\n",temp_fp);
  25.     fputs("\n",temp_fp);
  26.  
  27.     // title
  28.     fputs("@{b}Buffy Search Results@{ub}\n",temp_fp);
  29.     fputs("\n",temp_fp);
  30.  
  31.     // calc buffer
  32.     timestamp = time(NULL);
  33.     tp = localtime(×tamp);
  34.     sprintf(stuff,"Peformed on: %s\n",asctime(tp));
  35.  
  36.     // put fancy time of search
  37.     fputs(stuff,temp_fp);
  38.     fputs("\n",temp_fp);
  39.  
  40.     // string
  41.     sprintf(stuff,"Search string given was: %s\n",searchstring);
  42.     fputs(stuff,temp_fp);
  43.     fputs("\n",temp_fp);
  44.  
  45. } // end write_header
  46.  
  47.  
  48. // --------------
  49. // writes endnode
  50. // --------------
  51. void write_end(void) {
  52. char stuff[1000]="";
  53.  
  54.     // write number of matches
  55.     sprintf(stuff,"\nNo. of matches found: %d\n",matchesfound);
  56.     fputs(stuff,temp_fp);
  57.  
  58.     // write info sofar to search file
  59.     sprintf(stuff,"\nSearched %d lines and %d nodes, in %g secs\n", lines, nodes, (total / 60));
  60.     fputs(stuff,temp_fp);
  61.  
  62.     // End main node in results guide
  63.     fputs("\n@{I}Generated By the BuffyGuideSearch V1.0.2\n",temp_fp);
  64.     fputs("© Matthew J Fletcher - 2000@{ui}\n",temp_fp);
  65.     fputs("@endnode\n",temp_fp);
  66.  
  67. } // end write_end
  68.  
  69.  
  70.